﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Foundation.Markup
{
    public abstract class MarkupExtension : Binding, IValueConverter
    {
        protected MarkupExtension()
        {
            Source = Converter = this;
        }

        protected MarkupExtension(object source) // set Source to null for using DataContext
        {
            Source = source;
            Converter = this;
        }

        protected MarkupExtension(RelativeSource relativeSource)
        {
            RelativeSource = relativeSource;
            Converter = this;
        }

        public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);

        public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
